﻿// -------------------------------------------------------------------------------------------------------------------------------
// <copyright file="TestAddFactor.cs" company="Exul">
//     Copyright (c) Exul. All rights reserved.
// </copyright>
// <author>
//     Exul
// </author>
// -------------------------------------------------------------------------------------------------------------------------------

namespace ExulLibrary.Mathematics.LinearAlgebra.Sequential.Tests.DenseVectorTest.DoubleExtensions
{
    #region Usings

    using System;

    using ExulLibrary.Mathematics.LinearAlgebra.Sequential.DoubleExtensions;

    using NUnit.Framework;

    #endregion

    /// <summary>
    ///     Test suite for <see cref="DenseVectorExtensions.Add(DenseVector{double}, double)"/>.
    /// </summary>
    [TestFixture]
    [Category("ExulLibrary.Mathematics.LinearAlgebra.Sequential.DoubleExtensions.DenseVectorExtensions")]
    public sealed class TestAddFactor
    {
        /// <summary>
        ///     Tests the method.
        /// </summary>
        [Test]
        public void TestMethod()
        {
            // Arrange
            var instance = new DenseVector<double>(new double[] { 1, 2, 3 });

            // Act
            instance.Add(10);

            // Assert
            Assert.That(instance.Values, Is.EquivalentTo(new double[] { 11, 12, 13 }));
        }

#if SAFE

        /// <summary>
        ///     Tests the method when vector parameter is <see langword="null"/>.
        /// </summary>
        [Test]
        public void WhenInstanceIsNull()
        {
            // Act and Assert
            Assert.That(
                () => DenseVectorExtensions.Add(null, 10),
                Throws.TypeOf<ArgumentNullException>().With.Property("ParamName").EqualTo("vector"));
        }

#endif
    }
}